package com.cysion.otbox.ext

import android.app.Activity
import android.graphics.Color
import android.os.Build
import android.view.View
import androidx.annotation.ColorInt
import com.jaeger.library.StatusBarUtil

/*
* 状态栏扩展类
* */

//color-状态栏背景颜色
fun Activity.whiteTextTheme(@ColorInt color: Int) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        StatusBarUtil.setColor(this, color, 0)
        window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE//恢复状态栏白色字体
    }
}

//color-状态栏背景颜色
fun Activity.darkTextTheme(@ColorInt color: Int) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        StatusBarUtil.setColor(this, color, 0)
        window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR//恢复状态栏黑色字体
    }
}
//color-白色背景黑色文字
fun Activity.darkTextWhiteBg() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        StatusBarUtil.setColor(this, Color.parseColor("#FFFFFFFF"), 0)
        window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR//恢复状态栏黑色字体
    }
}